﻿@model mvcForum.AddOns.ViewModels.NewUserTrialViewModel
@using mvcForum.Web.Helpers;
@{
	String ns = "mvcForum.AddOns.NewUserTrial";
	ViewBag.Title = Html.LocalizedString("PageTitle", ns);
	Layout = "~/Areas/ForumAdmin/Views/Shared/adminlayout.cshtml";
}
<section id="newusertrial">
	<div class="row-fluid">
		<div class="span12">
@if (TempData.ContainsKey("Saved") && ((Boolean)TempData["Saved"])) {
			<div class="alert alert-success">
				<h4 class="alert-heading">@Html.LocalizedString("SuccessHeading", ns)</h4>
				@Html.LocalizedString("SuccessBody", ns)
			</div>
}
			@using (Html.BeginForm("index", "newusertrialconfiguration", new { area = "forumadmin" }, FormMethod.Post, new { @class = "form-horizontal" })) {
				<fieldset>
					<legend>@Html.LocalizedString("Heading", ns)</legend>
					@Html.ValidationSummary()
					<div class="control-group">
						@Html.LabelFor(x => x.Enabled, new { @class = "control-label" })
						<div class="controls">
							@Html.CheckBoxFor(x => x.Enabled, new { data_bind = "checked: Enabled" })
							@*<span class="help-block">A longer block of help text that breaks onto a new line and may extend beyond one line.</span>*@
						</div>
					</div>
					<div class="control-group hide" data-bind="css: { 'hide': !Enabled() }">
						@Html.LabelFor(x => x.RunAsynchronously, new { @class = "control-label" })
						<div class="controls">
							@Html.CheckBoxFor(x => x.RunAsynchronously, new { data_bind = "checked: RunAsynchronously" })
						</div>
					</div>
					<div class="control-group hide" data-bind="css: { 'hide': !Enabled() || !RunAsynchronously() }">
						@Html.LabelFor(x => x.Delay, new { @class = "control-label" })
						<div class="controls">
							@Html.TextBoxFor(x => x.Delay, new { @class = "input-small" })
							@*<span class="help-block">A longer block of help text that breaks onto a new line and may extend beyond one line.</span>*@
						</div>
					</div>
					<div class="control-group hide" data-bind="css: { 'hide': !Enabled() }">
						@Html.LabelFor(x => x.AutoLimit, new { @class = "control-label" })
						<div class="controls">
							@Html.TextBoxFor(x => x.AutoLimit, new { @class = "input-small" })
							@*<span class="help-block">A longer block of help text that breaks onto a new line and may extend beyond one line.</span>*@
						</div>
					</div>
					<div class="control-group hide" data-bind="css: { 'hide': !Enabled() }">
						@Html.LabelFor(x => x.ExcludeGroups, new { @class = "control-label" })
						<div class="controls">
							@Html.ListBoxFor(x => x.ExcludeGroups, ForumHelper.GetGroups(), new { @class = "input-medium", multiple = "multiple" })
							@*<span class="help-block">A longer block of help text that breaks onto a new line and may extend beyond one line.</span>*@
						</div>
					</div>
					<div class="form-actions">
						<button type="submit" class="btn btn-primary">@Html.LocalizedString("Button", ns)</button>
					</div>
				</fieldset>
			}
		</div>
	</div>
</section>
<script type="text/javascript">
	var runAsync = @Json.Encode(Model.RunAsynchronously);
	var enabled = @Json.Encode(Model.Enabled);
</script>

@section scripts {
	<script type="text/javascript" src="@Url.Content("~/scripts/knockout.validation.js")"></script>
	<script type="text/javascript" src="@Url.Content("~/scripts/boostrap-collapse.js")"></script>
	<script type="text/javascript" src="@Url.Content("~/scripts/common.js")"></script>
	<script type="text/javascript" src="@Url.Content("~/scripts/viewmodels/newusertrial.js")"></script>
}
